<?php
/**
 * View Artista LaFabbrica.org
 * 
 * @author     luigi.pastore (gigi@la-fabbrica.org)
 * @created    18-mag-2012
 * @package    LaFabbrica
 * @copyright  Copyright (c) 2011 Luigi Pastore
 */
?>
<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/js/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="/js/ckeditor/load-editor.js"></script>
<script type="text/javascript">
    //<![CDATA[
    $(document).ready(function() {
        $("#artist_info").rules("add", {
            required: true,
            messages: {
                required: "<?php echo ERR_EMPTY ?>"
            }
        });
        $("#artist_name").rules("add", {
            required: true,
            messages: {
                required: "<?php echo ERR_EMPTY ?>"
            }
        });
        
        $("#artist_info").ckeditor(function(){}, ckeditorConf );
        
        $("#salva").click(function(e) {
            // Risolve un bug d'integrazione tra jQuery e CKeditor
            CKEDITOR.instances.artist_info.updateElement();
            validator.form();
            return validator.element( "#artist_info" );
        });
    });
    //]]>
</script>

<div class="info">
    <h2>Inserisci Artista</h2>
    <div>Per inserire un nuovo post...</div>
    <div>I campi contrassegnati da <span class="req">*</span> sono obbligatori!</div>
</div>
<!-- This <div> holds alert messages to be display in the sample page. -->
<div id="alerts">
    <noscript>
    <p>
	<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
				support, like yours, you should still see the contents (HTML data) and you should
				be able to edit it normally, without a rich editor interface.
    </p>
    </noscript>
</div>
<form class="fab" name="artistForm" id="artistForm" action="/admin/artisti/info/id/<?php echo $this->artist_id ?>" method="post" enctype="multipart/form-data">
    <ul>
    <li class="paging-context ">
        <table class="pgStyle1 circle2" cellspacing="0">
            <tr>
                <td class="c selected">
                    <var>1</var>
                </td>
                <td class="t selected">
                    <b id="pagecircle1">Info Artista</b>
                </td>
                <td class="c ">
                    <var>2</var>
                </td>
                <td class="t">
                    <b id="pagecircle2">Immagini Artista</b>
                </td>
            </tr>
        </table>
    </li>
    </ul>
<div id="content">
        <ul>
	<li id="errorLi" style="<?php echo $this->errorMsg ? '' : 'display:none'?>">
	    <h3 id="errorMsgLbl">Si &egrave; verificato un problema durante l'invio del modulo.</h3>
	    <p id="errorMsg">
		Di seguito trovi evidenziati gli errori riscontrati.
	    </p>
	</li>
	
	<li class="<?php echo $this->errorMsg['artist_name'] ? 'error' : ''?>">
	    <label class="desc <?php echo $this->errorMsg['artist_name'] ? 'error' : ''?>">Nome<span class="req">*</span></label>
	    <div>
		<span>
		    <input id="artist_name" name="artist_name" class="field text large" type="text" maxlength="255" value="<?php echo $this->data['artist_name']?>" /> 
		</span>
	    </div>
	    <p class="error" style="<?php echo $this->errorMsg['artist_name'] ? 'display:block' : ''?>"><?php echo $this->errorMsg['artist_name']?></p>
	</li>
	
	<li class="<?php echo $this->errorMsg['artist_info'] ? 'error' : ''?>">
	    <label class="desc <?php echo $this->errorMsg['artist_info'] ? 'error' : ''?>">Info<span class="req">*</span></label>
	    <div>
		<span>
		    <textarea id="artist_info" name="artist_info" rows="10" cols="50"><?php echo htmlentities($this->data['artist_info'])?></textarea>
		</span>
	    </div>
	    <p class="error" style="<?php echo $this->errorMsg['artist_info'] ? 'display:block' : ''?>"><?php echo $this->errorMsg['artist_info']?></p>
	</li>
	
	<li class="section">
	    <h3>Links</h3>
	</li>
	
	<li class="<?php echo $this->errorMsg['artist_official'] ? 'error' : ''?>">
	    <label class="desc <?php echo $this->errorMsg['artist_official'] ? 'error' : ''?>">Sito Ufficiale</label>
	    <div>
		<span>
		    <input id="artist_official" name="artist_official" class="field text medium" type="text" maxlength="255" value="<?php echo $this->data['artist_official']?>" /> 
		</span>
	    </div>
	    <p class="error" style="<?php echo $this->errorMsg['artist_official'] ? 'display:block' : ''?>"><?php echo  $this->errorMsg['artist_official'] ?></p>
	    <p id="instruct1" class="instruct">
		<small>Inserisci eventuali link associati all'artista nella forma
		    <br/><strong> http://</strong>nomesito.tld</small>
	    </p>		    
	</li>
	<li class="<?php echo $this->errorMsg['artist_facebook'] ? 'error' : ''?>">
	    <label class="desc <?php echo $this->errorMsg['artist_facebook'] ? 'error' : ''?>">Facebook</label>
	    <div>
		<span>
		    <input id="artist_facebook" name="artist_facebook" class="field text medium" type="text" maxlength="255" value="<?php echo $this->data['artist_facebook']?>" /> 
		</span>
	    </div>
	    <p class="error" style="<?php echo $this->errorMsg['artist_facebook'] ? 'display:block' : ''?>"><?php echo $this->errorMsg['artist_facebook']?></p>
	</li>
	<li class="<?php echo $this->errorMsg['artist_myspace'] ? 'error' : ''?>">
	    <label class="desc <?php echo $this->errorMsg['artist_myspace'] ? 'error' : ''?>">MySpace</label>
	    <div>
		<span>
		    <input id="artist_myspace" name="artist_myspace" class="field text medium" type="text" maxlength="255" value="<?php echo $this->data['artist_myspace']?>" /> 
		</span>
	    </div>
	    <p class="error" style="<?php echo $this->errorMsg['artist_myspace'] ? 'display:block' : ''?>"><?php echo $this->errorMsg['artist_myspace']?></p>
	</li>
    </ul>
</div>
    <div id="formButtons">
        <button id="salva" type="submit" name="salva" value="salva" class="button positive">
            <img src="/images/admin/tick.png" alt="" />Continua
        </button>
        <button id="annulla" name="annulla" value="annulla" class="button negative">
            <img src="/images/admin/cross.png" alt="" />Annulla
        </button>
    </div>
</form>